package palms.authserver;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class KerberosAS implements Runnable{

	private AuthLogic as;
	
	public KerberosAS(AuthLogic as){
		this.as = as;
	}
	
	@Override
	public void run() {
		try {

			ServerSocket ssocket = new ServerSocket(as.getKasport());
			System.out.println("[KAS]-->Server is running...");
			while(true){
				Socket s = ssocket.accept();
				System.out.println("[KAS]-->Received a connection...");
				KASWorker worker = new KASWorker(s, as);
				Thread t = new Thread(worker);
				t.start();
				System.out.println("[KAS]-->Launched a worker to process message...");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
